import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

// 使用工厂模式创建线程
public class Demo31 {
    public static void main(String[] args) {
        ThreadFactory threadFactory = Executors.defaultThreadFactory();
        Thread t = threadFactory.newThread(()->{
            System.out.println("线程执行任务!");
        });
        t.start();
    }
}
